﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections.ObjectModel;
using Mimi.Models.UIModels;
using GalaSoft.MvvmLight.CommandWpf;
using Mimi.Models.DataModels;

namespace Mimi.ViewModels
{
    public interface IExpenseViewModel
    {
        #region Properties
        /// <summary>
        /// Collection of expense data model
        /// </summary>
        List<Expense> ExpenseCollection { get; set; }

        /// <summary>
        /// This collection is using to bind list of expense item to UI
        /// </summary>
        ObservableCollection<UIExpense> BindingExpenseCollection { get; set; }

        /// <summary>
        /// Display add form for new expense
        /// </summary>
        bool IsDisplayAddForm { get; set; }

        /// <summary>
        /// Expense description
        /// </summary>
        string ExpenseDescription { get; set; }

        /// <summary>
        /// Expense date
        /// </summary>
        DateTime? ExpenseDate { get; set; }

        /// <summary>
        /// Expense amount
        /// </summary>
        string ExpenseAmount { get; set; }

        /// <summary>
        /// Total Expense
        /// </summary>
        double TotalExpense { get; set; }

        /// <summary>
        /// This collection get data from predefined purposes and bind to UI
        /// </summary>
        ObservableCollection<string> Purposes { get; set; }

        /// <summary>
        /// Selected purpose item
        /// </summary>
        string SelectedPurposeItem { get; set; }

        /// <summary>
        /// Filter from date
        /// </summary>
        DateTime FilterFromDate { get; set; }

        /// <summary>
        /// Filter to date
        /// </summary>
        DateTime FilterToDate { get; set; }

        /// <summary>
        /// Filter using date
        /// </summary>
        bool IsFilteringOnDate { get; set; }

        /// <summary>
        /// Filter using budget
        /// </summary>
        bool FilterOnBudget { get; set; }

        /// <summary>
        /// Display filtered list view
        /// </summary>
        bool IsDisplayFilteredList { get; set; }

        /// <summary>
        /// Collection of items passed filter conditions
        /// </summary>
        ObservableCollection<UIExpense> FilteredCollection { get; set; }

        /// <summary>
        /// Selected budget for filtering
        /// </summary>
        string FilterSelectedPurposeItem { get; set; }
        #endregion

        #region Commands
        /// <summary>
        /// Display Add Form
        /// </summary>
        RelayCommand DisplayAddForm { get; }

        /// <summary>
        /// Command to add a new expense
        /// </summary>
        RelayCommand AddExpenseCommand { get; }

        /// <summary>
        /// Command to apply filter on expense data
        /// </summary>
        RelayCommand ApplyFilterCommand { get; }

        /// <summary>
        /// Show all data
        /// </summary>
        RelayCommand ShowAllCommand { get; }
        #endregion

        #region Methods
        /// <summary>
        /// Add new expense
        /// </summary>
        void AddExpense();

        /// <summary>
        /// Load purpose collection
        /// </summary>
        /// <param name="purposeCollection"></param>
        void LoadPurposeList(IEnumerable<Purpose> purposeCollection);

        /// <summary>
        /// Load stored expense data
        /// </summary>
        void LoadStoredData();

        /// <summary>
        /// Update purpose collection
        /// </summary>
        /// <param name="purpose"></param>
        void UpdatePurposeList(Purpose purposeItem);

        /// <summary>
        /// Remove item from purpose collection
        /// </summary>
        /// <param name="purpose"></param>
        void DeletePurpose(Purpose purposeItem);

        /// <summary>
        /// Apply filter on data
        /// </summary>
        void ApplyFilter();
        #endregion
    }
}
